package com.qf.common.mp.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Author hehecheng
 * Date 2024/11/11
 * 祝我们都能遇见真诚的人
 * 见字如面
 */
@Configuration
public class QueueConfig {

    // 处理运动轨迹的队列
    @Bean
    public Queue trackLogQueue() {
        return new Queue("track_log");
    }

    // 交换机
    @Bean
    public DirectExchange orderExchange() {
        return new DirectExchange("ex_order");
    }

    // 队列和交换机进行绑定
    @Bean
    public Binding orderStatusBinding() {
        return BindingBuilder.bind(trackLogQueue()).to(orderExchange()).with("track.log");
    }
}
